"""
URL configuration for interfaceTestPlatform project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/5.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from tkinter.font import names

from django.contrib import admin
from django.urls import path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView, TokenVerifyView
from rest_framework import routers

from BugManage.views import BugView
from Cronjob.views import CronJobView
from Scenes.views import TestSceneView, TestSceneToCaseView, TestSceneToCaseModifyView
from TestInterface.views import TestInterfaceView, TestInterfaceCaseView
from TestTask.views import TestTaskView, TestRecordView, TestReportView
from Testproject.views import TestProjectView, TestEnvView, TestFiletView
from users.views import UserLoginView

router = routers.SimpleRouter()

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/users/login/', UserLoginView.as_view(), name='login'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    path('api/token/verify/', TokenVerifyView.as_view(), name='token_verify'),
    path('api/testFlow/icases/order/', TestSceneToCaseModifyView.as_view(), name='icase_order'),
    path('api/TestInterFace/cases/run/', TestInterfaceView.as_view({
        "post": "run_case"
    }), name='case_run'),
    path("api/testFlow/scenes/run/", TestSceneView.as_view({
        "post": "run_scene"
    }), name="scene_run"),
    path("api/testTask/tasks/run/", TestTaskView.as_view({
        "post": "run_task"
    }), name="task_run")
]

router.register('api/testPro/projects', TestProjectView)
router.register('api/testPro/envs', TestEnvView)
router.register('api/testPro/files', TestFiletView)
router.register('api/TestInterFace/interfaces', TestInterfaceView)
router.register('api/TestInterFace/cases', TestInterfaceCaseView)
router.register('api/testFlow/scenes', TestSceneView)
router.register('api/testFlow/icases', TestSceneToCaseView)
router.register('api/testTask/tasks', TestTaskView)
router.register('api/testTask/records', TestRecordView)
router.register('api/testTask/report', TestReportView)
router.register('api/crontab/cronjob', CronJobView)
router.register('api/bug/bugs', BugView)
urlpatterns += router.urls
